package com.heima.freemarker;

import io.minio.MinioClient;
import io.minio.PutObjectArgs;
import io.minio.errors.*;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;

public class minioTeat {
    public static void main(String[] args) throws IOException, ServerException, InvalidBucketNameException, InsufficientDataException, ErrorResponseException, NoSuchAlgorithmException, InvalidKeyException, InvalidResponseException, XmlParserException, InternalException {
        FileInputStream fileInputStream=new FileInputStream("D://index.html");

        MinioClient client = MinioClient.builder().credentials("minio", "minio123").endpoint("http://8.137.100.17:9000")
                .build();
        PutObjectArgs putObjectArgs = PutObjectArgs.builder().object("index.html").bucket("cd75").contentType("text/html")
                .stream(fileInputStream, fileInputStream.available(), -1).build();
        client.putObject(putObjectArgs);

          System.out.println("http://8.137.100.17:9000/cd75/index.html");
    }
}
